from django.db import models

# Create your models here.
from utils.mybase_model import Base

class Path(Base): #路径表
    title = models.CharField(max_length=50)
    img = models.ImageField(upload_to='imgs/',null=True)
    desc = models.CharField(max_length=255,null=True)
    class Meta:
        db_table = "tb_path"

class Stage(models.Model): #阶段表
    title = models.CharField(max_length=50)
    numb = models.CharField(max_length=32,verbose_name="阶段编号")
    path = models.ForeignKey(Path,on_delete=models.CASCADE,null=True)
    class Meta:
        db_table = "tb_stage"

class User_Path(models.Model):  #用户加入路径表
    user = models.ForeignKey('user.User',on_delete=models.CASCADE)
    path = models.ForeignKey(Path, on_delete=models.CASCADE, null=True)
    class Meta:
        db_table = "tb_user_path"
